
** illustrate bias

* 1. plot of bias against upper bound

use tables/estimates_bs_ci, clear 

gen ratio = bias_ub_non / ub_non_m

gen c0 = ""
local c = 0
local row = 0  
foreach v in ub_non_m bias_ub_non ratio{
	local ++c
	local row = 1
	gen c`c' = "`v' &" in 1
	sum `v' ,d 
	foreach stat in mean min p25 p50 p75 max {
		local ++row
		replace c0 = "`stat' &" in `row'
		replace c`c' = string(r(`stat'),"%4.3f") + " & " in `row'
	}
}

replace c3 = subinstr(c3, "&", "\\", .) in 1/`row'
list c0-c3 in 1/`row', noobs clean
outsheet c0-c3 in 2/`row' using tables/bias.tex, replace noquote nonames ///
	delimit(" ")
	
	
sum bias_ub_non


** 2. probabiltiy binding 
# delimit ;
twoway
	(line flip_non week)
	,
	xtitle("") ytitle("") ylabel(0(.1).5) title("Probability", span pos(11) size(medium))
	xlabel(`=mdy(3,13,2020)' "3/13" `=mdy(6,13,2020)' "6/13"  
		`=mdy(9,13,2020)' "9/13" `=mdy(12,13,2020)' "12/13", labsize(medium) )
	graphregion(color(white))
;
# delimit cr
graph export figures/flip_rate.pdf, replace 

